<{include file="section/admin/admin_header.tpl"}>
<script type="text/javascript" src="<{$smarty.const._DOMAIN_SC_CDN_}>/upload/zx/sc/js/highslide/highslide-with-html.js"></script>
<link rel="stylesheet" type="text/css" href="<{$smarty.const._DOMAIN_SC_CDN_}>/upload/zx/sc/js/highslide/highslide.css" />
<script type="text/javascript">
hs.graphicsDir = '<{$smarty.const._DOMAIN_SC_CDN_}>/upload/zx/sc/js/highslide/graphics/';
hs.outlineType = 'rounded-white';
hs.wrapperClassName = 'draggable-header';
</script>
<style type="text/css">
/* lab */
/* add.05.13 star */
.lab01{background:url(http://cms.f.itc.cn/upload/ihome/images/admin_bg01.gif) repeat-x 0 0 #fff;height:30px;}
.lab01 li{padding:3px 16px 0 15px;float:left;line-height:26px;color:#00a100;background:url(http://cms.f.itc.cn/upload/ihome/images/admin_bg01.gif) no-repeat 100% -31px #fff;cursor:pointer}
.lab01 li.active{margin-left:-1px;border-left:1px solid #ddd; background:url(http://cms.f.itc.cn/upload/ihome/images/admin_bg01.gif) no-repeat 100% -60px #f6f6f6;padding-bottom:1px;color:#333;font-weight:bold;cursor:auto}
.lab01 li.bgnone{background:none}
.lab01 span.right{line-height:30px;margin-right:10px;display:inline}
/* add.05.13 end */
.lab03{height:38px;line-height:38px;color:#aaa}
.lab03 a, .lab03 a:hover{ text-decoration:underline;color:#00a100}

</style>
<style type="text/css">
		#tab{
		}
		#tab li{
			float:left;
			font-size:16px;
			color:#034795;
			background:none;
			/*border-bottom:1px solid #E1E1E1;*/
			padding:5px 10px 2px 10px;
			cursor:pointer;
		}
		#tab li._active{
			color:#FFFFFF;
			cursor:default;
			background:#00A100;
			border-top:1px solid #E1E1E1;
			border-left:1px solid #E1E1E1;
			border-right:1px solid #E1E1E1;
			/*border-bottom:1px solid #FAFAFA;*/
		}
		#tab li._line{
			height:16px;
			width:539px;;
			background:none;
			border-top:1px solid transparent;
			border-bottom:1px solid #E1E1E1;
			cursor:default;
		}
		</style>

<body>
<{include file="section/admin/admin_header_login_bar.tpl"}>
<div id="contentA" class="clear" style="width:1300px;">
	<!--leftsidebar sr-->
	<{include file="section/admin/admin_left_sidebar.tpl"}>
    <!--/leftsidebar end-->
    <div class="rightCont">
    	<!--path st-->
		<div class="path">您的位置：<a href="/">首页</a>&gt; 专题商品推荐列表</div>
		<!--/path end-->
		
		<{$message}>

    	<h2 class="title01"><span>专题商品推荐列表</span></h2>
        <div class="line1"></div>
		<div class="box02">
			<div class="search02 clear">
				<form action="/recommend/subject" id="frm_query" method="get">
					<ul>
						<li> &nbsp;&nbsp; 推荐分类：
						<select style="width:120px;" name="subject_type_name">
						<option value="">全部分类</option>
						<{foreach from=$subject_type key=key item=item}>
						<option value="<{$key}>" <{if $key == $type}>selected="true"<{/if}>><{$item}></option>
						<{/foreach}>
						</select>
						</li>
						<li>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="查询" class="btn01" />
						<input type="reset" value="重置" class="btn02" /></li>
					</ul>
				</form>
			</div>
			<ul> &nbsp;</ul>
			<form id="frm" action="/recommend/subject" method="get">
				<input type="hidden" value="add" name="action">
				<div class="box02_1">
					<div class="box_Tab">
						<div class="table01">
                    	<table cellpadding="0" cellspacing="0" width="100%" border="0" id="table">
                        <tr class="th">
                        <th><div>商品ID</div></th>
						<th><div class="tl">商品名称</div></th>
						<th><div>商铺名称</div></th>
                        <th><div>价格(元)</div></th>
                        <th><div>推荐分类</div></th>
						<th><div>排序</div></th>
						<th><div>操作</div></th>
                        </tr>
						<{if $data | @count > 0}>
						<{foreach from=$data key=key item=item}>
						<tr>
						<td><{$item.goods_id}></td>
						<td class="tl"><a href="<{$item.goods_url}>" target="_blank"><{$item.title}></a></td>
						<td><a href="<{$item.shop_url}>" target="_blank"><{$item.shop_name}></a></td>
						<td><{$item.price}></td>
						<td><{$item.status_name}></td>
						<td><div id="view_<{$item.goods_id}>" name="view_<{$item.goods_id}>"><{$item.num}></div></td>
						<td><a href="" onclick="return hs.htmlExpand(this)">专题</a> <div class="highslide-maincontent">
						标题：<input type="text" name="goods_title_<{$item.goods_id}>" id="goods_title_<{$item.goods_id}>" value="<{$item.desc}>" /> 可选,默认为目前的商品标题<br/>
						<span style="color:red;">*</span>分类：<select name="subject_type_<{$item.goods_id}>" id="subject_type_<{$item.goods_id}>" style="width:130px;">
								<{foreach from=$subject_type key=k item=subject}>
								<option value="<{$k}>" <{if $k == $item.status}>selected=true<{/if}>><{$subject}></option>
								<{/foreach}>
							  </select><br/>
						<span style="color:red;">*</span>排序：<input type="text" name="subject_num_<{$item.goods_id}>" id="subject_num_<{$item.goods_id}>" value="<{$item.num}>" /><br/>
						<span style="color:red;">*</span>价格：<input type="text" name="subject_price_<{$item.goods_id}>" id="subject_price_<{$item.goods_id}>" value="<{$item.price}>" /><br/>
						图片地址：<input type="text" name="subject_pic_<{$item.goods_id}>" id="subject_pic_<{$item.goods_id}>" value="<{$item.pic_url}>" style="width:180px;"/><br/>
						运费说明：<input type="text" name="subject_fare_<{$item.goods_id}>" id="subject_fare_<{$item.goods_id}>" value="<{$item.fare}>" />
						<input type="button" name="onsubmit" value="提交" onclick="goto_subject_submit(<{$item.goods_id}>)"/>
						</div> | <a href="javascript:void(0);" onclick="goto_cancel(<{$item.recommend_id}>)">取消</a>
						</td>
                        </tr>
						<{/foreach}>
						<{/if}>
<script>
function goto_subject_submit(good_id)
{
	var goods_id	= parseInt(good_id);

	if(goods_id <= 0)
	{
		alert("参数错误！");

		return false;
	}

	var num			= document.getElementById("subject_num_" + goods_id);
	
	var goods		= document.getElementById("goods_title_" + goods_id);
	
	var subject		= document.getElementById("subject_type_" + goods_id);

	var obj_price	= document.getElementById("subject_price_" + goods_id);

	var obj_pic_url	= document.getElementById("subject_pic_" + goods_id);

	var obj_fare	= document.getElementById("subject_fare_" + goods_id);

	var fare	= obj_fare.value;

	var	num		= num.value;

	var type	= subject.value;	

	var title	= goods.value;

	var price	= obj_price.value;

	var pic		= obj_pic_url.value;

	var num		= Number(num);
	
	if(parseFloat(num) <= 0 || Number(price) <= 0)
	{
		alert("请填写排序以及价格!");
		
		return false;
	}

	$.post('/recommend/addsubject/',
	{
		num			 : num,
		subject_type : type,
		goods_id	 : goods_id,
		title		 : title,
		price		 : price,
		pic_url		 : pic,
		fare		 : fare
	},
	function(o){
		
		window.location.href = window.location.href;

	},
	'html'
	); 
}

</script>

                        </table>
					    </div>
					</div>
                </div>
                <div class="box02_lab clear">
                </div>
			</form>
        </div>
       总计: <{$total}> <{$pagination}> 
    </div>
</div>
</body>
<script type="text/javascript">
var frm = document.getElementById('frm');

function goto_cancel(id)
{
	var id	= parseInt(id);

	if(id <= 0)
	{
		alert('参数错误'); return false;
	}
	
	$.post('/recommend/delrecommend/',
	{
		del_id		: id
	},
	function(o){

		//alert(o);
		
		window.location.href = window.location.href;

	},
	'html'
	); 
}

function goto_submit(good_id)
{
	var goods_id	= parseInt(good_id);

	if(goods_id <= 0)
	{
		alert("参数错误！");

		return false;
	}

	var num	= document.getElementById("num_" + goods_id).value;

	document.getElementById("num").value	= num;

	document.getElementById("goods_id").value = goods_id;


	var goods_type = '<{$type}>';

	$.post('/recommend/addgoods/',
	{
		num 	  : num,
		good_type : goods_type,
		goods_id  : goods_id
	},
	function(o){

		//alert(o);
		
		window.location.href = window.location.href;

		//document.getElementById("view_" + goods_id).innerHTML = num;
	},
	'html'
	); 
}
</script>
</html>
